﻿@model bool?
@{ 
     Layout = ViewBag.Layout;
    string prefix = ViewData.TemplateInfo.HtmlFieldPrefix.Replace(ViewData.ModelMetadata.PropertyName, "").Trim('.');
    ViewData.TemplateInfo.HtmlFieldPrefix = prefix;
    var propertyName = ViewData["name"] == null ? ViewData.ModelMetadata.PropertyName : ViewData["name"].ToString();


    var editorHtmlAttributes = Html.GetUnobtrusiveValidationAttributes(propertyName, ViewData.ModelMetadata).Merge(ViewData.ModelMetadata.AdditionalValues, true);
    var htmlAttributes = ViewBag.HtmlAttributes;
    if (htmlAttributes != null)
    {
        if (htmlAttributes is IDictionary<string, object>)
        {
            editorHtmlAttributes.Merge((IDictionary<string, object>)htmlAttributes);
        }
        else
        {
            editorHtmlAttributes.Merge(new RouteValueDictionary(htmlAttributes));
        }
    }
}

<tr>
    <th></th>
    <td>
        @Html.CheckBox(propertyName, Model.HasValue ? Model.Value : false, editorHtmlAttributes)
        <label for="@ViewData.TemplateInfo.GetFullHtmlFieldId(propertyName)" class="inline">
            @ViewData.ModelMetadata.GetDisplayName().Localize()</label>
        @if (!string.IsNullOrEmpty(ViewData.ModelMetadata.Description))
        {
            <em class="tip">@Html.Raw(ViewData.ModelMetadata.Description.Localize())</em>
        }    </td>
</tr>


